package com.jz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Hasee on 2022-03-07.
 */
@RestController
@RefreshScope//刷新配置的意思，当我们在nacos改资源，它会自动更新本地配置
public class ProviderController {
    @GetMapping("testProvider")
    public String testProvider(){
        return "hello provider!===8081";
    }
    @Autowired
    private Config config;

//    @Value("${student.name}")
//    private String mysql;

//    @GetMapping("test2")
//    public String test2(){
//        return mysql;
//    }

    @GetMapping("test")
    public String test(){
        String name = config.getName();
        return name;
    }

}
